home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / OutputStream.java < prev    next >
Text File  |  1998-09-22  |  4KB  |  111 lines

  1. /*
  2.  * @(#)OutputStream.java    1.15 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.io;
  16.  
  17. /**
  18.  * This abstract class is the superclass of all classes representing 
  19.  * an output stream of bytes. 
  20.  * <p>
  21.  * Applications that need to define a subclass of 
  22.  * <code>OutputStream</code> must always provide at least a method 
  23.  * that writes one byte of output. 
  24.  *
  25.  * @author  Arthur van Hoff
  26.  * @version 1.15, 07/01/98
  27.  * @see     java.io.BufferedOutputStream
  28.  * @see     java.io.ByteArrayOutputStream
  29.  * @see     java.io.DataOutputStream
  30.  * @see     java.io.FilterOutputStream
  31.  * @see     java.io.InputStream
  32.  * @see     java.io.OutputStream#write(int)
  33.  * @since   JDK1.0
  34.  */
  35. public abstract class OutputStream {
  36.     /**
  37.      * Writes the specified byte to this output stream. 
  38.      * <p>
  39.      * Subclasses of <code>OutputStream</code> must provide an 
  40.      * implementation for this method. 
  41.      *
  42.      * @param      b   the <code>byte</code>.
  43.      * @exception  IOException  if an I/O error occurs.
  44.      * @since      JDK1.0
  45.      */
  46.     public abstract void write(int b) throws IOException;
  47.  
  48.     /**
  49.      * Writes <code>b.length</code> bytes from the specified byte array 
  50.      * to this output stream. 
  51.      * <p>
  52.      * The <code>write</code> method of <code>OutputStream</code> calls 
  53.      * the <code>write</code> method of three arguments with the three 
  54.      * arguments <code>b</code>, <code>0</code>, and 
  55.      * <code>b.length</code>. 
  56.      *
  57.      * @param      b   the data.
  58.      * @exception  IOException  if an I/O error occurs.
  59.      * @see        java.io.OutputStream#write(byte[], int, int)
  60.      * @since      JDK1.0
  61.      */
  62.     public void write(byte b[]) throws IOException {
  63.     write(b, 0, b.length);
  64.     }
  65.  
  66.     /**
  67.      * Writes <code>len</code> bytes from the specified byte array 
  68.      * starting at offset <code>off</code> to this output stream. 
  69.      * <p>
  70.      * The <code>write</code> method of <code>OutputStream</code> calls 
  71.      * the write method of one argument on each of the bytes to be 
  72.      * written out. Subclasses are encouraged to override this method and 
  73.      * provide a more efficient implementation. 
  74.      *
  75.      * @param      b     the data.
  76.      * @param      off   the start offset in the data.
  77.      * @param      len   the number of bytes to write.
  78.      * @exception  IOException  if an I/O error occurs.
  79.      * @since      JDK1.0
  80.      */
  81.     public void write(byte b[], int off, int len) throws IOException {
  82.     for (int i = 0 ; i < len ; i++) {
  83.         write(b[off + i]);
  84.     }
  85.     }
  86.  
  87.     /**
  88.      * Flushes this output stream and forces any buffered output bytes 
  89.      * to be written out. 
  90.      * <p>
  91.      * The <code>flush</code> method of <code>OutputStream</code> does nothing.
  92.      *
  93.      * @exception  IOException  if an I/O error occurs.
  94.      * @since      JDK1.0
  95.      */
  96.     public void flush() throws IOException {
  97.     }
  98.  
  99.     /**
  100.      * Closes this output stream and releases any system resources 
  101.      * associated with this stream. 
  102.      * <p>
  103.      * The <code>close</code> method of <code>OutputStream</code> does nothing.
  104.      *
  105.      * @exception  IOException  if an I/O error occurs.
  106.      * @since      JDK1.0
  107.      */
  108.     public void close() throws IOException {
  109.     }
  110. }
  111.